package com.xyy.saas.payment.service.impl;

import com.xyy.saas.payment.dao.mapper.FBankInterfaceUpgradeMapper;
import com.xyy.saas.payment.dao.model.FBankInterfaceUpgrade;
import com.xyy.saas.payment.service.FBankInterfaceUpgradeService;
import org.springframework.stereotype.Service;
import org.springframework.util.CollectionUtils;
import org.springframework.util.StringUtils;
import javax.annotation.Resource;

@Service
public class FBankInterfaceUpgradeServiceImpl implements FBankInterfaceUpgradeService {
    @Resource
    private FBankInterfaceUpgradeMapper fBankInterfaceUpgradeMapper;

    /**
     * 根据参数查询
     */
    @Override
    public boolean exist(FBankInterfaceUpgrade param) {
        if(param == null) {
            return false;
        }

        if(StringUtils.isEmpty(param.getAccountId()) && StringUtils.isEmpty(param.getAccountName())) {
            return false;
        }

        return !CollectionUtils.isEmpty(fBankInterfaceUpgradeMapper.queryByParam(param));
    }

    /**
     * 插入
     */
    @Override
    public void insertSelective(FBankInterfaceUpgrade record) {
        if(exist(record)) {
            return;
        }

        fBankInterfaceUpgradeMapper.insertSelective(record);
    }
}
